<template>
  <div>

    <a-card :bordered="false">
      <f-search-form :more="false" @searchHandler="searchHandler">
        <f-search-form-item label="项目代码" name="projectCode" />
        <f-search-form-item label="项目名称" name="projectName" />
      </f-search-form>
      <f-table
      style="margin-top:60px"
        ref="table"
        size="default"
        rowKey="roleId"
        :data-source="dataSource"
        :columns="columns"
        :multiple="false"
        :params="queryParam"
      >
        <span slot="action" slot-scope="text, record">
          <template>
             <a @click="$refs.detail.handleShow(record)">一览表</a>
            <a-divider type="vertical" />
          </template>
          <template>
            <a @click="$refs.detail.handleShow(record)">汇总详情</a>
            <a-divider type="vertical" />
          </template>
           <template>
            <a @click="download" >同步到sap</a>
            <a-divider type="vertical" />
          </template>
           <template>
            <a>导出报表</a>
            <a-divider type="vertical" />
          </template>
        </span>
      </f-table>
      <summarydetail ref="detail"></summarydetail>
    </a-card>
  </div>
</template>


<script>
import summarydetail from './summarydetail'
export default {
  name: 'TableList',
  components: { summarydetail },
  data() {
    return {
      //列表初始化查询参数
      queryParam: {},
      dataSource: [

        { projectCode: 'YB110', projectName: '这是项目一', versionName: '提交人', version: '100.00', endTime: '2020-1-22 7:55:22' },
       { projectCode: 'YB111', projectName: '这是项目二', versionName: '提交人', version: '100.01', endTime: '2020-1-22 7:55:22' },
       { projectCode: 'YB112', projectName: '这是项目三', versionName: '提交人', version: '100.01', endTime: '2020-1-22 7:55:22' },
       { projectCode: 'YB113', projectName: '这是项目四', versionName: '提交人', version: '100.03', endTime: '2020-1-22 7:55:22' },



      ],

      // 表头
      columns: [
        {
          title: '项目代码',
          dataIndex: 'projectCode',
        },
        {
          title: '项目名称',
          dataIndex: 'projectName',
        },
        {
          title: '当前版本提交人',
          dataIndex: 'versionName',
        },
        {
          title: '项目当前版本',
          dataIndex: 'version',
        },
        {
          title: '最近一次版本提交时间',
          dataIndex: 'endTime',
        },
        {
          title: '操作',
          dataIndex: 'action',
          width: '370px',
          scopedSlots: { customRender: 'action' },
        },
      ],
      //操作按钮
      operator: [
        {
          name: '添加角色',
          icon: 'plus',
          that: this,
          handler: function (table, that) {
            that.$refs.modal.handleShow()
          },
        },
        {
          name: '删除',
          icon: 'delete',
          batch: true,
          handler: function (table) {
            table.remove()
          },
        },
      ],
    }
  },
  created() {},
  methods: {
    setStatus(record) {
      this.http.post(this, {
        url: this.api.managerUser.setStatus,
        data: {
          userId: record.roleId,
        },
        success(me, data) {
          record.status = data
        },
      })
    },
    download() {
      window.location.href = '/WBS预算报表.xlsx'
    }
  },
}
</script>
<style lang='scss' scoped>
//@import url(); 引入公共css类
</style>